pragma Singleton

import QtQuick 2.0

Item{


    function getValue(jsonArrayObj,index,query){
        return jsonArrayObj[index][query]
    }

    function getKeyList(obj){
         var arr=[];
         for (var k in obj){
                arr.push(k)
         }
         return arr
    }

    //从js对象字符串获取数组
    function getArray(jsonString,field){
        var jsObject = JSON.parse(jsonString)
        for ( var key in jsObject ) {
            if(key === field){
            return jsObject[key]
            }
        }
    }

    function objectToStr(obj){
        var str = JSON.stringify(obj)
        return str
    }
    function strToObject(jsonStr){
        var obj = JSON.parse(jsonStr)
        return obj
    }
}
